package com.laicunba.service.analysis.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.laicunba.dao.GenericQueryDao;
import com.laicunba.service.analysis.AccountBalanceAnalysisService;

@Service
public class AccountBalanceAnalysisServiceImpl implements AccountBalanceAnalysisService {

	@Autowired
	protected GenericQueryDao queryDao;

	@Override
	public BigDecimal countDebt() {
		return queryDao.selectOne("ACCOUNT_BALANCE_ANALYSIS.countDebt", null);
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public BigDecimal countActivityCost(Date beginDate, Date endDate) {
		Map map = new HashMap();
		map.put("beginDate", beginDate);
		map.put("endDate", endDate);
		return queryDao.selectOne("ACCOUNT_BALANCE_ANALYSIS.countActivityCost", map);
	}

	@Override
	public BigDecimal countAllRemainProfit() {
		return queryDao.selectOne("ACCOUNT_BALANCE_ANALYSIS.countAllRemainProfit", null);
	}
}
